# =================conding: utf-8
"""
================================================================================

Author : Administrator
Created  on : 2020/11/22

E-mail: zh13997821732@163.com


================================================================================

"""
# 1.定义一个元组
tu1 = (1, 2)
print(type(tu1))

# 2.定义一个只有1个元素的元组
tu1 = (1,)
print(type(tu1))

# 3.定义一个元组，查询某个元素的个数
tu1 = (1, 2, 'a', 'a', 'b', 'c', 'c', 'c')
j = 0
for i in tu1:
    if i == 'c':
        j += 1
print(j)

# 4.定义一个元组，查询某个元素的索引值
tu1 = (1, 2, 3, 4, 5, 6, 7)
print(tu1.index(5))

# 5.定义一个元组，获取元组中最大的元素
tu1 = (1, 2, 3, 4, 5, 6, 7)
print(max(tu1))

# 6.定义一个元组，获取元组中最小的元素
tu1 = (1, 2, 3, 4, 5, 6, 7)
print(min(tu1))

# 7.定义一个元组，获取元组中第3个元素
tu1 = (1, 2, 3, 4, 5, 6, 7)
print(tu1[2])

# 8.定义一个有9个元素的列表，取出从第3个位置到倒数第二，间隔为2，所有的元素
tu1 = (1, 2, 3, 4, 5, 6, 7, 8, 9, 1)
print(tu1[-2])
print(tu1[2:-1:2])
